package cn.woniu.ecommerceplatform.service.impl;

import cn.woniu.ecommerceplatform.entity.HomePage;
import cn.woniu.ecommerceplatform.mapper.HomePageMapper;
import cn.woniu.ecommerceplatform.service.HomePageService;
import cn.woniu.ecommerceplatform.util.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomePageServiceImpl implements HomePageService {

    @Autowired(required = false)
    private HomePageMapper homePageMapper;


    @Override
    public ResponseResult<?> queryGoodList() {
        List<HomePage> homePages = homePageMapper.queryGood();
        if(homePages!=null && homePages.size() > 0){
            return new ResponseResult<>().ok(homePages);
        }else {
            return new ResponseResult<>().notok();
        }
    }

    @Override
    public ResponseResult<?> queryTypeList() {
        List<HomePage> homePages = homePageMapper.queryType();
        if(homePages!=null && homePages.size() > 0){
            return new ResponseResult<>().ok(homePages);
        }else {
            return new ResponseResult<>().notok();
        }
    }

    @Override
    public ResponseResult<?> queryMoneyList() {
        HomePage homePages = homePageMapper.queryMoney();
        if(homePages!=null){
            return new ResponseResult<>().ok(homePages);
        }else {
            return new ResponseResult<>().notok();
        }
    }
    
}
